package com.xy.util;

import android.content.Context;
import android.os.Build;
import android.telephony.TelephonyManager;

/**
 * Created by XuYang
 * 2023/4/28
 * Email:544066591@qq.com
 */
public class DeviceUtil {

    public static String getImei(Context context) {
        String imei = "";
        try {
            TelephonyManager mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                imei = mTelephonyManager.getImei();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return imei;
    }

    public static String getSN() {
        return Build.SERIAL;
    }
}
